/*     */ package btsm.bean;
/*     */ 
/*     */ import java.io.PrintStream;
/*     */ import java.sql.ResultSet;
/*     */ import javax.servlet.http.HttpServletRequest;
/*     */ import javax.servlet.http.HttpServletResponse;
/*     */ 
/*     */ public class page
/*     */ {
/*  15 */   String sqlCount = "";
/*  16 */   String sqlPage = "";
/*  17 */   int ShowPage = 1;
/*  18 */   int RowCount = 0;
/*  19 */   int PageCount = 0;
/*  20 */   int redundance = 0;
/*     */   public String HttpFile;
/*     */   String tablea;
/*     */   String ida;
/*  26 */   public int listindexa = 0;
/*  27 */   public int listworka = 0;
/*  28 */   public String texta = null;
/*  29 */   private sqlwork sw = null;
/*     */ 
/*     */   public page(String tableaa, String idaa)
/*     */   {
/*  33 */     this.tablea = tableaa;
/*  34 */     this.ida = idaa;
/*  35 */     swInit();
/*     */   }
/*     */ 
/*     */   private void swInit() {
/*  39 */     if (this.sw == null)
/*  40 */       this.sw = new sqlwork(this.tablea, this.ida);
/*     */   }
/*     */ 
/*     */   public void dbConClose() {
/*  44 */     if (this.sw != null)
/*  45 */       this.sw.dbConClose();
/*     */   }
/*     */ 
/*     */   public ResultSet myQuery(HttpServletRequest request, HttpServletResponse response, int PageType, int PageSize) throws Exception
/*     */   {
/*  50 */     swInit();
/*     */ 
/*  52 */     this.HttpFile = request.getRequestURI();
/*     */ 
/*  54 */     this.RowCount = this.sw.getCountPage();
/*     */ 
/*  57 */     this.redundance = (this.RowCount % PageSize);
/*  58 */     if (this.redundance == 0) {
/*  59 */       this.PageCount = (this.RowCount / PageSize);
/*     */     } else {
/*  61 */       this.PageCount = ((this.RowCount - this.redundance) / PageSize);
/*  62 */       this.PageCount += 1;
/*     */     }
/*  64 */     String ToPage = request.getParameter("ToPage");
/*  65 */     System.out.println("before ToPage:" + ToPage);
/*  66 */     if ((ToPage == null) || (!ToPage.matches("^[0-9]*$"))) {
/*  67 */       ToPage = "1";
/*     */     }
/*  69 */     System.out.println("ToPage:" + ToPage);
/*  70 */     this.ShowPage = Integer.parseInt(ToPage);
/*  71 */     if (this.ShowPage > this.PageCount) {
/*  72 */       this.ShowPage = this.PageCount;
/*     */     }
/*  74 */     if (this.ShowPage <= 0) {
/*  75 */       this.ShowPage = 1;
/*     */     }
/*     */ 
/*  78 */     return this.sw.scpage(this.ShowPage, PageSize);
/*     */   }
/*     */ 
/*     */   public ResultSet DicQuery(HttpServletRequest request, HttpServletResponse response, int PageType, int PageSize)
/*     */     throws Exception
/*     */   {
/*  84 */     swInit();
/*     */ 
/*  86 */     this.HttpFile = request.getRequestURI();
/*     */ 
/*  88 */     this.RowCount = this.sw.getCountPage();
/*     */ 
/*  90 */     this.redundance = (this.RowCount % PageSize);
/*  91 */     if (this.redundance == 0) {
/*  92 */       this.PageCount = (this.RowCount / PageSize);
/*     */     } else {
/*  94 */       this.PageCount = ((this.RowCount - this.redundance) / PageSize);
/*  95 */       this.PageCount += 1;
/*     */     }
/*  97 */     String ToPage = request.getParameter("ToPage");
/*  98 */     System.out.println("before DicPage:" + ToPage);
/*  99 */     if ((ToPage == null) || (!ToPage.matches("^[0-9]*$"))) {
/* 100 */       ToPage = "1";
/*     */     }
/* 102 */     System.out.println("DicPage:" + ToPage);
/* 103 */     this.ShowPage = Integer.parseInt(ToPage);
/* 104 */     if (this.ShowPage > this.PageCount) {
/* 105 */       this.ShowPage = this.PageCount;
/*     */     }
/* 107 */     if (this.ShowPage <= 0) {
/* 108 */       this.ShowPage = 1;
/*     */     }
/*     */ 
/* 111 */     return this.sw.DicPage(this.ShowPage, PageSize);
/*     */   }
/*     */ 
/*     */   public ResultSet interconBFQuery(HttpServletRequest request, HttpServletResponse response, int PageType, int PageSize, String strFilter) throws Exception
/*     */   {
/* 116 */     swInit();
/*     */ 
/* 118 */     this.HttpFile = request.getRequestURI();
/*     */ 
/* 120 */     this.RowCount = this.sw.getCountPage();
/*     */ 
/* 122 */     this.redundance = (this.RowCount % PageSize);
/* 123 */     if (this.redundance == 0) {
/* 124 */       this.PageCount = (this.RowCount / PageSize);
/*     */     } else {
/* 126 */       this.PageCount = ((this.RowCount - this.redundance) / PageSize);
/* 127 */       this.PageCount += 1;
/*     */     }
/* 129 */     String ToPage = request.getParameter("ToPage");
/* 130 */     System.out.println("before DicPage:" + ToPage);
/* 131 */     if ((ToPage == null) || (!ToPage.matches("^[0-9]*$"))) {
/* 132 */       ToPage = "1";
/*     */     }
/* 134 */     System.out.println("DicPage:" + ToPage);
/* 135 */     this.ShowPage = Integer.parseInt(ToPage);
/* 136 */     if (this.ShowPage > this.PageCount) {
/* 137 */       this.ShowPage = this.PageCount;
/*     */     }
/* 139 */     if (this.ShowPage <= 0) {
/* 140 */       this.ShowPage = 1;
/*     */     }
/*     */ 
/* 143 */     return this.sw.interconBFPage(this.ShowPage, PageSize, strFilter);
/*     */   }
/*     */ 
/*     */   public ResultSet DicFQuery(HttpServletRequest request, HttpServletResponse response, int PageType, int PageSize, String strFilter)
/*     */     throws Exception
/*     */   {
/* 149 */     swInit();
/*     */ 
/* 151 */     this.HttpFile = request.getRequestURI();
/*     */ 
/* 153 */     this.RowCount = this.sw.getCountPage();
/*     */ 
/* 155 */     this.redundance = (this.RowCount % PageSize);
/* 156 */     if (this.redundance == 0) {
/* 157 */       this.PageCount = (this.RowCount / PageSize);
/*     */     } else {
/* 159 */       this.PageCount = ((this.RowCount - this.redundance) / PageSize);
/* 160 */       this.PageCount += 1;
/*     */     }
/* 162 */     String ToPage = request.getParameter("ToPage");
/* 163 */     System.out.println("before DicPage:" + ToPage);
/* 164 */     if ((ToPage == null) || (!ToPage.matches("^[0-9]*$"))) {
/* 165 */       ToPage = "1";
/*     */     }
/* 167 */     System.out.println("DicPage:" + ToPage);
/* 168 */     this.ShowPage = Integer.parseInt(ToPage);
/* 169 */     if (this.ShowPage > this.PageCount) {
/* 170 */       this.ShowPage = this.PageCount;
/*     */     }
/* 172 */     if (this.ShowPage <= 0) {
/* 173 */       this.ShowPage = 1;
/*     */     }
/*     */ 
/* 176 */     return this.sw.DicFPage(this.ShowPage, PageSize, strFilter);
/*     */   }
/*     */ 
/*     */   public ResultSet myCableQuery(HttpServletRequest request, HttpServletResponse response, int PageType, int PageSize)
/*     */     throws Exception
/*     */   {
/* 182 */     swInit();
/*     */ 
/* 184 */     this.HttpFile = request.getRequestURI();
/*     */ 
/* 186 */     this.RowCount = this.sw.getCableCountPage();
/*     */ 
/* 188 */     this.redundance = (this.RowCount % PageSize);
/* 189 */     if (this.redundance == 0) {
/* 190 */       this.PageCount = (this.RowCount / PageSize);
/*     */     } else {
/* 192 */       this.PageCount = ((this.RowCount - this.redundance) / PageSize);
/* 193 */       this.PageCount += 1;
/*     */     }
/* 195 */     String ToPage = request.getParameter("ToPage");
/* 196 */     System.out.println("before ToPage:" + ToPage);
/* 197 */     if ((ToPage == null) || (!ToPage.matches("^[0-9]*$"))) {
/* 198 */       ToPage = "1";
/*     */     }
/* 200 */     System.out.println("ToPage:" + ToPage);
/* 201 */     this.ShowPage = Integer.parseInt(ToPage);
/* 202 */     if (this.ShowPage > this.PageCount) {
/* 203 */       this.ShowPage = this.PageCount;
/*     */     }
/* 205 */     if (this.ShowPage <= 0) {
/* 206 */       this.ShowPage = 1;
/*     */     }
/*     */ 
/* 209 */     return this.sw.scCablePage(this.ShowPage, PageSize);
/*     */   }
/*     */ 
/*     */   public ResultSet myUsersQuery(HttpServletRequest request, HttpServletResponse response, int PageType, int PageSize) throws Exception
/*     */   {
/* 214 */     swInit();
/*     */ 
/* 216 */     this.HttpFile = request.getRequestURI();
/*     */ 
/* 218 */     this.RowCount = this.sw.getUsersCountPage();
/*     */ 
/* 220 */     this.redundance = (this.RowCount % PageSize);
/* 221 */     if (this.redundance == 0) {
/* 222 */       this.PageCount = (this.RowCount / PageSize);
/*     */     } else {
/* 224 */       this.PageCount = ((this.RowCount - this.redundance) / PageSize);
/* 225 */       this.PageCount += 1;
/*     */     }
/*     */ 
/* 228 */     String ToPage = request.getParameter("ToPage");
/*     */ 
/* 230 */     if ((ToPage == null) || (!ToPage.matches("^[0-9]*$"))) {
/* 231 */       ToPage = "1";
/*     */     }
/*     */ 
/* 234 */     this.ShowPage = Integer.parseInt(ToPage);
/* 235 */     if (this.ShowPage > this.PageCount) {
/* 236 */       this.ShowPage = this.PageCount;
/*     */     }
/* 238 */     if (this.ShowPage <= 0) {
/* 239 */       this.ShowPage = 1;
/*     */     }
/*     */ 
/* 242 */     return this.sw.scUsersPage(this.ShowPage, PageSize);
/*     */   }
/*     */ 
/*     */   public int getTotalPages()
/*     */   {
/* 248 */     return this.PageCount;
/*     */   }
/*     */ 
/*     */   public int getCurrenPages()
/*     */   {
/* 254 */     return this.ShowPage;
/*     */   }
/*     */ 
/*     */   public int getRowCount()
/*     */   {
/* 259 */     return this.RowCount;
/*     */   }
/*     */ 
/*     */   public String PageFooter()
/*     */   {
/* 264 */     String str = "";
/*     */ 
/* 266 */     int prev = this.ShowPage - 1;
/* 267 */     int next = this.ShowPage + 1;
/* 268 */     str = str + "<form aciont=" + this.HttpFile + ">";
/* 269 */     str = str + "查询到<span>" + getRowCount() + "</span>条记录" + 
/* 270 */       "    共<span>" + getTotalPages() + "</span>页";
/* 271 */     str = str + " 第<span>" + getCurrenPages() + "</span>页 ";
/* 272 */     if (this.ShowPage > 1)
/* 273 */       str = str + " <A href=" + this.HttpFile + "?ToPage=1" + ">首页</A> ";
/*     */     else {
/* 275 */       str = str + " 首页 ";
/*     */     }
/* 277 */     if (this.ShowPage > 1)
/* 278 */       str = str + " <A href=" + this.HttpFile + "?ToPage=" + prev + ">上一页</A> ";
/*     */     else {
/* 280 */       str = str + " 上一页 ";
/*     */     }
/* 282 */     if (this.ShowPage < this.PageCount)
/* 283 */       str = str + " <A href=" + this.HttpFile + "?ToPage=" + next + ">下一页</A> ";
/*     */     else {
/* 285 */       str = str + " 下一页 ";
/*     */     }
/* 287 */     if ((this.PageCount > 1) && (this.ShowPage != this.PageCount))
/* 288 */       str = str + " <A href=" + this.HttpFile + "?ToPage=" + this.PageCount + 
/* 289 */         ">尾页</A>";
/*     */     else {
/* 291 */       str = str + " 尾页 ";
/*     */     }
/* 293 */     str = str + "&nbsp;&nbsp;第<input name=ToPage type=text size=2>页 <input type=submit value=GO></form>";
/* 294 */     return str;
/*     */   }
/*     */ }

/* Location:           E:\java\apache-tomcat-6.0.36\webapps\btsm\WEB-INF\classes\
 * Qualified Name:     btsm.bean.page
 * JD-Core Version:    0.6.2
 */